//
//  YNSSetCommonCell.m
//  HNBaseProject
//
//  Created by xujie on 2024/6/23.
//

#import "YNSSetCommonCell.h"

@implementation YNSSetCommonCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self createUI];
    }
    return self;
}

- (void)createUI {
    self.selectionStyle = 0;
    self.backgroundColor = [UIColor whiteColor];
    
    self.nameLab = [[UILabel alloc] init];
    [self.contentView addSubview:self.nameLab];
    self.nameLab.textColor = [UIColor colorWithHexString:@"#11182F"];
    self.nameLab.font = PFRFont(16);
    [self.nameLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(15);
        make.centerY.mas_equalTo(self.contentView);
    }];
    
    self.rightImageV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"联合 16"]];
    self.rightImageV.hidden = YES;
    [self.contentView addSubview:self.rightImageV];
    [self.rightImageV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.contentView);
        make.right.offset(-16);
    }];
    
    self.rightLab = [[UILabel alloc] init];
    self.rightLab.textColor = [UIColor colorWithHexString:@"#979797"];
    self.rightLab.font = PFRFont(16);
    [self.contentView addSubview:self.rightLab];
    [self.rightLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.contentView);
        make.right.offset(-32);
    }];
    
    self.line = [[UIView alloc] init];
    [self.contentView addSubview:self.line];
    self.line.backgroundColor = [UIColor colorWithHexString:@"#f5f5f5"];
    [self.line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.offset(0);
        make.left.offset(15);
        make.right.offset(-15);
        make.height.mas_equalTo(1);
    }];
}

- (void)reloadCellWithTitle:(NSString *)title select:(BOOL)select{
    self.nameLab.text = title;
    self.rightImageV.hidden = !select;
}

@end
